import request from './request.js'

// 订单模块接口集合

/**
 * 删除订单
 * @param {Array} ids 订单id集合
 */
export const deleteOrder = (ids) => {
	return request.delete('/orders', ids)
}

/**
 * 有限制的修改订单
 * @param {Object} data 修改订单DTO
 */
export const updateOrder = (data) => {
	return request.put('/orders', data)
}

/**
 * 订单分页查询
 * @param {Object} data 订单分页数据DTO
 */
export const getOrdersPage = (data) => {
	return request.post('/orders/page', data)
}

/**
 * 获取订单详情
 * @param {String} id 订单id
 */
export const getOrderDetails = (id) => {
	return request.get(`/orders/${id}`)
}

/**
 * 完成订单
 * @param {String} id 订单id
 */
export const accomplishOrder = (id) => {
	return request.put(`/orders/${id}`)
}

/**
 * 更新单个订单变为可退款
 * @param {Object} data 退款状态启用请求DTO
 */
export const enableRefundStatus = (data) => {
	return request.post('/paymentRecords/refundStatus', data)
}

/**
 * 返回该订单是否为不可退款
 * @param {String} id 订单id
 */
export const getIsRefundable = (id) => {
	return request.get(`/paymentRecords/${id}`)
}